//
//  NSBundle+BundleName.m
//  EpubSDK
//
//  Created by linziyuan on 16/12/5.
//  Copyright © 2016年 creative. All rights reserved.
//

#import "NSBundle+BundleName.h"
#import "NSObject+Telen.h"

@implementation NSBundle (BundleName)

+ (void)load
{
     //NSLocalizedStringFromTable(str, @"ReadVCLocalizable", @"")
   // [NSBundle.mainBundle localizedStringForKey:(key) value:@"" table:(tbl)]
    [self swizzleSelector:@selector(localizedStringForKey:value:table:) withSelector:@selector(jrsdk_localizedStringForKey:value:table:)];
}

- (NSString *)jrsdk_localizedStringForKey:(NSString *)key value:(NSString *)value table:(NSString *)tableName
{
    NSBundle *finalBundel = [NSBundle bundleForClass:NSClassFromString(@"JReaderSDKManager")];
    if (finalBundel) {
        NSString* str = [finalBundel jrsdk_localizedStringForKey:key value:value table:tableName];
        if (str == nil || [str isEqualToString:key]) {
            return [self jrsdk_localizedStringForKey:key value:value table:tableName];
        }
        return str;
    }else{
        return [self jrsdk_localizedStringForKey:key value:value table:tableName];
    }
}


@end
